package com.globallogic.strelchuk.usermanager.service;

import java.util.List;

import javax.inject.Named;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import com.globallogic.strelchuk.usermanager.dao.ActivityDao;
import com.globallogic.strelchuk.usermanager.domain.Activity;

@Named
public class ActivityServiceImpl implements ActivityService {

	@Autowired
	private ActivityDao activityDao;

	@Transactional
	public void addActivity(Activity activity) {
		activityDao.addActivity(activity);
	}

	@Transactional
	public void removeActivity(Integer id) {
		activityDao.removeActivity(id);
	}

	@Transactional
	public List<Activity> listAllActivities(Integer userId) {
		return activityDao.listAllActivities(userId);
	}

	@Transactional
	public List<Activity> listNotDoneActivities(Integer userId) {
		return activityDao.listNotDoneActivities(userId);
	}

	@Transactional
	public void markActivityDone(Integer id) {
		activityDao.markActivityDone(id);
	}

	@Transactional
	public void markActivityUndone(Integer id) {
		activityDao.markActivityUndone(id);
	}
	
	@Transactional
	public void setEditable(Integer id, boolean editable) {
		activityDao.setEditable(id, editable);
	}

	@Transactional
	public void editActivity(Activity activity, Integer id) {
		activityDao.editActivity(activity, id);
	}

	@Transactional
	public Activity getActivityById(int id) {
		return activityDao.getActivityById(id);
	}
}
